#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>

typedef union {
	unsigned int id[3];
	struct {
		unsigned int c;
		unsigned int i;
		unsigned short int s;
	} __attribute__((packed)) data;
} DATA;

int main () {
	unsigned int a = 0xdffc;
	printf("[0x%04x]\n", ~a & 0xFFFF); 
	unsigned int b = 1;
	unsigned int c = 0;
	a = (~b) << 3;
	a = (~c) << 4;
	printf("[0x%04x]\n", ~a & 0xFFFF); 


	DATA d;
	memset(&d, 0x00, sizeof(d));

	printf("[%d]\n", sizeof(d)); 
	printf("[%d]\n", sizeof(d.id)); 
	printf("[%d]\n", sizeof(d.data)); 
	//*uar = 0x80db & 0xFFFF;
	int i = 0;
	for (i = 0; i < (3*16); i++) {
		*(d.id) |= 1 << i;
	}
	printf("[0x%04x]\n", d.id[0]); 
	printf("[0x%04x]\n", d.id[1]); 
	printf("[0x%04x]\n", d.id[2]); 

	printf("\n"); 

	printf("[0x%04x]\n", d.data.c); 
	printf("[0x%04x]\n", d.data.i); 
	printf("[0x%04x]\n", d.data.s); 


	printf("===================\n"); 
	a = 0x790 & 0xFFFF;
	printf("[%d]\n", a & 0x10); 

	printf("===================\n"); 

	return 0;
}
